Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETCDCTL_README: clarify the usage of ETCDCTL_* variables #11138

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

spzala
Copy link
Member

@spzala spzala commented Sep 9, 2019

@jingyih
Copy link
Contributor

jingyih commented Sep 9, 2019

Just for clarification, is it only the ETCDCTL_API got unset in lock exec? Or every env starting ETCDCTL_?

@jingyih
Copy link
Contributor

jingyih commented Sep 9, 2019

I just tried on 3.3 release where etcdctl API is defaulted to v2. The following command will not work because ETCDCTL_API is unset:

$ ETCDCTL_API=3 ./bin/etcdctl lock mylock ./bin/etcdctl put foo bar
No help topic for 'put'
Error:  exit status 3

Other ETCDCTL_ env variables seem to work.

$ ETCDCTL_ENDPOINTS=http://127.0.0.1:2379 ETCDCTL_API=3 etcdctl lock mylock env | grep ETCDCTL
ETCDCTL_ENDPOINTS=http://127.0.0.1:2379

@jingyih
Copy link
Contributor

jingyih commented Sep 9, 2019

I guess it is fine to just document the behavior clearly. But it is definitely a little wired if user wants to execute a v3 command upon lock acquisition.

@spzala
Copy link
Member Author

spzala commented Sep 9, 2019

@jingyih thanks and yes it's only ETCDCTL_API that etcdctl will unset [1]. Besides that, ETCTCTL_ are only allowed to use with etcdctl flags. So for example, ETCDCTL_X gives this error:
2019-08-26 22:03:41.908806 W | pkg/flags: unrecognized environment variable ETCDCTL_X=3
[1] https://github.com/etcd-io/etcd/blob/master/etcdctl/main.go#L33

Copy link
Contributor

@jingyih jingyih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spzala
Copy link
Member Author

spzala commented Sep 10, 2019

Safe merge so going for it :)

@spzala spzala merged commit 62822c5 into etcd-io:master Sep 10, 2019
@spzala spzala deleted the lock10840 branch September 13, 2019 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

etcdctl unsetting ETCDCTL_API in lock exec
2 participants